<?php
$api = app('Dingo\Api\Routing\Router');

$api->version('v1', [
  'namespace' => 'Zxf5115\Laravel\Dictionary\Controllers\Platform'
], function ($api)
{
  $api->group([
    'middleware' => 'api.throttle', // 启用节流限制
    'limit' => 1000, // 允许次数
    'expires' => 1, // 分钟
    'prefix' => 'platform/kernel' // 接口前缀
  ], function ($api)
  {
    // --------------------------------------------------
    // 核心路由
    $api->group(['middleware' => ['white.list', 'black.list', 'auth:platform', 'refresh.token.platform']], function ($api) {
      // 字典路由
      $api->group(['prefix' => 'dictionary'], function ($api) {
        $api->any('list', 'DictionaryController@list');
        $api->get('select', 'DictionaryController@select');
        $api->get('data', 'DictionaryController@data');
        $api->get('view/{id}', 'DictionaryController@view');
        $api->any('level', 'DictionaryController@level');
        $api->post('handle', 'DictionaryController@handle');
        $api->post('delete', 'DictionaryController@delete');

        // 字典参数路由
        $api->group(['namespace' => 'Dictionary', 'prefix' => 'parameter'], function ($api) {
          $api->any('list', 'ParameterController@list');
          $api->get('select', 'ParameterController@select');
          $api->get('view/{id}', 'ParameterController@view');
          $api->post('handle', 'ParameterController@handle');
          $api->post('delete', 'ParameterController@delete');
        });
      });
    });
  });
});
